<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>下载文件到浏览器中</title>
<link rel="stylesheet" type="text/css" href="https://res.kuoqps.com/kuoqi-ui/web.dev.css">
<script src="https://res.kuoqps.com/kuoqi-js/kq.1.06/kq.1.06.dev.js"></script>
</head>

<body>
<textarea id="textarea" class="form-textarea" rows="16" placeholder="一行一个"></textarea>
<button id="start">立即启动</button>
</body>
<script>
	var arr = [];
	var index = 0;
	function winopen(index){
		if(arr[index]){
			var url = arr[index];
			var win = window.open(arr[index]);
			var intval = setInterval(function(){
				if(win.document==undefined){
					//文件下载完成
						index++;
						clearInterval(intval);
						win.close();
						$Q.msg('关闭打开'+index);
						winopen(index);
				}
			},200);
		}else{
			$Q.alert('采集完成');	
		}
	}
	function winopens(arr){
		index = 0;
		winopen(index);
		
	}
	$Q('#start').click(function(){
		var text = $Q('#textarea').val();
		arr = text.split("\n");
		winopens(arr);
	});
</script>
</html>
